import Vue from 'vue';
import axios from 'axios';
import VueAxios from 'vue-axios';
Vue.use(VueAxios, axios);

// Add a request interceptor 
axios.interceptors.request.use(function (config) {
    // Do something before request is sent 
    return config;
  }, function (error) {
    // Do something with request error 
    return Promise.reject(error);
  });
// Add a response interceptor 
axios.interceptors.response.use(function (response) {
    return response;
  }, function (error) {
    return Promise.reject(error.response.data)   // 返回接口返回的错误信息
});